package com.kuang.allproject.reposity;

import com.kuang.allproject.entity.test;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface testReposity extends JpaRepository<test,Integer> {


    @Query("select t from test t where userName = :goodsName")
    test getOneByGoodsName(@Param("goodsName") String goodsName);


    @Query("update test set couponName = :couponName ,couponNo = couponNo + 1 where userName = :userName and couponNo = :couponNo")
    int saveByVersion(@Param("userName") String userName,@Param("couponName") String couponName,@Param("couponNo") String couponNo);
}
